import { ref, onMounted } from 'vue'
import { reqHomeBannerData } from '@/apis/home'

export function useBanner() {
	const bannerList = ref([])

	async function getBannnerData() {
		try {
			const res = await reqHomeBannerData({ distributionSite: '2' })
			bannerList.value = res.result
		} catch (error) {
			ElMessage({
				type: 'error',
				message: error.response?.data?.error,
			})
		}
	}

	onMounted(() => {
		getBannnerData()
	})

	return {
		bannerList,
	}
}
